from wcs.libs.players import players
from wcs.libs.items import items

itemName = 'Stone of Health'
item = items.addItem(itemName)
item.setGroup("powerup")
item.setCost(6000)
item.setDescription("The special rocks restor life. Heal 100 health and armor.")
item.aliveToUse = True
item.appendToUser = False

def wcs_item_bought(event_var):
    """
    Executed when a player has purchased an item. If the item purcahsed was this
    item, then ensure that we add to the player's health and armor
    """
    if event_var['item'] == itemName:
        userid = event_var["userid"]
        player = players[userid]
        player.heal(100)
        player.armorAdd(100)
